package com.springboot.project.controller;

import com.springboot.project.domain.City;
import com.springboot.project.service.ICityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liupenghui
 * @date 2018/7/10
 * @desc：
 */
@RestController
@RequestMapping(value = "/api")
public class CityRestController {

    @Autowired
    private ICityService cityService;

    @RequestMapping(value = "/city", method = RequestMethod.GET)
    public City findOneCity(@RequestParam(value = "cityName", required = true) String cityName) {
        return cityService.findCityByName(cityName);
    }
}
